import Mock from 'mockjs'


const getDataTree = {
        data: [{
            "host": "",
            "id": '00',
            "name": "上海节点",
            "parentId": 0,
            "password": "eer",
            "port": 80,
            "type": 0,
            "username": "zansan",
            children: [{
                "host": "",
                "id": '111',
                "name": "dev环境",
                "parentId": '00',
                "password": "eer",
                "port": 80,
                "type": 0,
                "username": "zansan",
                children: [{
                    "host": "localhost",
                    "id": '111-1',
                    "name": "localhost",
                    "parentId": '111',
                    "password": "eer",
                    "port": 80,
                    "type": 0,
                    "username": "zansan",
                    children: []
                }, ]
            }, {
                "host": "",
                "id": '222',
                "name": "sit环境",
                "parentId": '00',
                "password": "eer",
                "port": 80,
                "type": 0,
                "username": "zansan",
                children: [{
                    "host": "localhost2",
                    "id": '222-1',
                    "name": "192.168.1",
                    "parentId": '222',
                    "password": "eer",
                    "port": 80,
                    "type": 1,
                    "username": "zansan",
                    children: []
                }, ]
            }, {
                "host": "192.168.2",
                "id": '333',
                "name": "192.168.2",
                "parentId": '00',
                "password": "eer",
                "port": 80,
                "type": 1,
                "username": "zansan",
                children: []
            }]
        }],
        code: 0,
        msg: 'ok'
    }
    // 目录
Mock.mock(/\/ssh\/manage\/findTree/, getDataTree)


//add
const addData = {
    data: {
        "host": "localhost",
        "name": "localhost",
        "parentId": 0,
        "password": "",
        "port": 80,
        "username": "张三"
    },
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/ssh\/manage\/add/, addData)

//addFolder
const addFolder = {
    data: {
        "name": "addFolder",
        "parentId": 0
    },
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/ssh\/manage\/addFolder/, addFolder)


//delete
const deleteById = {
    data: {
        "id": 0
    },
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/ssh\/manage\/delete/, deleteById)


//testConn
const testConn = {
    data: true,
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/ssh\/manage\/testConn/, testConn)

//update
const update = {
    data: {},
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/ssh\/manage\/update/, update)
    //update
const updateFolder = {
    data: {},
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/ssh\/manage\/updateFolder/, updateFolder)



//currentInfo
const currentInfo = {
    data: {
        path: '/', // 路径
        fileInfos: [{
            filename: 'home',
            group: '组名',
            isDir: true, // 是否文件夹
            mTime: '2022-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '3024', // ⼤⼩，字节
            user: '⽤户名', // ⽤户名
        }, {
            filename: 'aa.txt',
            group: '组名', // 组名
            isDir: false, // 是否文件夹
            mTime: '2023-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '2024', // ⼤⼩，字节
            user: '⽤户名22', // ⽤户名
        }]
    },
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/sftp\/currentInfo/, currentInfo)
    //sftpDel
const sftpDel = {
    data: {
        path: '/', // 路径
        fileInfos: [{
            filename: 'home',
            group: '组名',
            isDir: true, // 是否文件夹
            mTime: '2022-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '3024', // ⼤⼩，字节
            user: '⽤户名', // ⽤户名
        }, {
            filename: 'aa.txt',
            group: '组名', // 组名
            isDir: false, // 是否文件夹
            mTime: '2023-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '2024', // ⼤⼩，字节
            user: '⽤户名22', // ⽤户名
        }]
    },
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/sftp\/del/, sftpDel)

//sftpUpload
const sftpUpload = {
    data: 'wehjtyuerwwdsf',
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/sftp\/upload/, sftpUpload)

//sftpDownload
const sftpDownload = {
    data: 'abcdefg12345',
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/sftp\/download/, sftpDownload)


//sftpMkdir
const sftpMkdir = {
    data: {
        path: '/home', // 路径
        fileInfos: [{
            filename: '文件名',
            group: '组名',
            isDir: true, // 是否文件夹
            mTime: '2022-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '3024', // ⼤⼩，字节
            user: '⽤户名', // ⽤户名
        }, {
            filename: '文件名2',
            group: '组名', // 组名
            isDir: false, // 是否文件夹
            mTime: '2023-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '2024', // ⼤⼩，字节
            user: '⽤户名22', // ⽤户名
        }, {
            filename: 'aaa',
            group: '组名', // 组名
            isDir: true, // 是否文件夹
            mTime: '2023-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '3024', // ⼤⼩，字节
            user: '⽤户名22', // ⽤户名
        }]
    },
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/sftp\/mkdir/, sftpMkdir)

//sftpRename
const sftpRename = {
    data: {
        path: '/home', // 路径
        fileInfos: [{
            filename: '文件夹2',
            group: '组名',
            isDir: true, // 是否文件夹
            mTime: '2022-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '3024', // ⼤⼩，字节
            user: '⽤户名', // ⽤户名
        }, {
            filename: '文件名3',
            group: '组名', // 组名
            isDir: false, // 是否文件夹
            mTime: '2023-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '2024', // ⼤⼩，字节
            user: '⽤户名22', // ⽤户名
        }, {
            filename: 'aaa1',
            group: '组名', // 组名
            isDir: true, // 是否文件夹
            mTime: '2023-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '3024', // ⼤⼩，字节
            user: '⽤户名22', // ⽤户名
        }]
    },
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/sftp\/rename/, sftpRename)


//sftpCd
const sftpCd = {
    data: {
        path: '/home', // 路径
        fileInfos: [{
            filename: 'demo',
            group: 'tt',
            isDir: true, // 是否文件夹
            mTime: '2022-12-15 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '4024', // ⼤⼩，字节
            user: '⽤户名', // ⽤户名
        }, {
            filename: 'ddd.txt',
            group: 'tt', // 组名
            isDir: false, // 是否文件夹
            mTime: '2023-12-05 12:33', // 修改时间（毫秒）
            permissions: 'root', // 权限
            size: '2024', // ⼤⼩，字节
            user: '⽤户名22', // ⽤户名
        }]
    },
    code: 0,
    msg: 'ok'
}
Mock.mock(/\/sftp\/cd/, sftpCd)